home *** CD-ROM | disk | FTP | other *** search
/ Macworld Expo - Develope…Central & Net Innovations / Developer Central and Net Innovators (MacWorld Expo) (January 1999).iso / Developer Central / Bowers Development / Demo AppMaker / Examples / PowerPlant / Gadgets / DDocData.cp < prev    next >
Encoding:
Text File  |  1998-10-11  |  8.6 KB  |  619 lines  |  [TEXT/CWIE]

  1. // DDocData.cp -- data container class for Gadgets
  2.  
  3. #include "DDocData.h"
  4.  
  5. #include <LFileStream.h>
  6.  
  7.  
  8. //----------
  9. DDocData::DDocData ()
  10. {
  11.     mTriangle = false;
  12.     mLeftRight = false;
  13.     mRadios = 0;
  14.     mBars = 0;
  15.     mStandard2 = 5;
  16.     mGraphic = 5;
  17.     mSlider = 5;
  18.     mTickMarks = 5;
  19.     mNonDirectional = 5;
  20.     mLittleArrows = 5;
  21.     mSpinner = 5;
  22.     mVolumeControl = 3;
  23.     mJimSSlider = 5;
  24.     mStandard3 = 5;
  25.     mIndeterminate = 5;
  26.     mChasingArrows = 5;
  27.     mRectangle = 5;
  28.     mRoundRect = 5;
  29.     mBarberPole = 5;
  30.     mRoundBarber = 5;
  31.     LString::CopyPStr ("\psmall", mSmall);
  32.     LString::CopyPStr ("\plarge", mLarge);
  33.     mX12345 = 0;
  34.     mX12345e6 = 0.0;
  35.     LString::CopyPStr ("\ppassword", mPassword);
  36.     GetLongDateTime (&mDate);
  37.     GetLongDateTime (&mTime);
  38.     LString::CopyPStr ("\pstyled", mStyled);
  39. }
  40.  
  41. //----------
  42. DDocData::~DDocData ()
  43. {
  44. }
  45.  
  46. //----------
  47. void    DDocData::CopyFrom (
  48.     DDocData*        inOther)
  49. {
  50.     mTriangle = inOther->mTriangle;
  51.     mLeftRight = inOther->mLeftRight;
  52.     mRadios = inOther->mRadios;
  53.     mBars = inOther->mBars;
  54.     mStandard2 = inOther->mStandard2;
  55.     mGraphic = inOther->mGraphic;
  56.     mSlider = inOther->mSlider;
  57.     mTickMarks = inOther->mTickMarks;
  58.     mNonDirectional = inOther->mNonDirectional;
  59.     mLittleArrows = inOther->mLittleArrows;
  60.     mSpinner = inOther->mSpinner;
  61.     mVolumeControl = inOther->mVolumeControl;
  62.     mJimSSlider = inOther->mJimSSlider;
  63.     mStandard3 = inOther->mStandard3;
  64.     mIndeterminate = inOther->mIndeterminate;
  65.     mChasingArrows = inOther->mChasingArrows;
  66.     mRectangle = inOther->mRectangle;
  67.     mRoundRect = inOther->mRoundRect;
  68.     mBarberPole = inOther->mBarberPole;
  69.     mRoundBarber = inOther->mRoundBarber;
  70.     LString::CopyPStr (inOther->mSmall, mSmall);
  71.     LString::CopyPStr (inOther->mLarge, mLarge);
  72.     mX12345 = inOther->mX12345;
  73.     mX12345e6 = inOther->mX12345e6;
  74.     LString::CopyPStr (inOther->mPassword, mPassword);
  75.     mDate = inOther->mDate;
  76.     mTime = inOther->mTime;
  77.     LString::CopyPStr (inOther->mStyled, mStyled);
  78. }
  79.  
  80. //----------
  81. void    DDocData::ReadFromFile (
  82.     LFileStream*    inFile)
  83. {
  84. }
  85.  
  86. //----------
  87. void    DDocData::WriteToFile (
  88.     LFileStream*    inFile)
  89. {
  90. }
  91.  
  92.  
  93. //----------
  94. Boolean        DDocData::GetTriangle () const
  95. {
  96.  
  97.     return mTriangle;
  98. }
  99.  
  100. //----------
  101. void    DDocData::SetTriangle (
  102.     Boolean        inValue)
  103. {
  104.     mTriangle = inValue;
  105.     
  106.     SignalDataChanged (idTriangle);
  107. }
  108.  
  109.  
  110. //----------
  111. Boolean        DDocData::GetLeftRight () const
  112. {
  113.  
  114.     return mLeftRight;
  115. }
  116.  
  117. //----------
  118. void    DDocData::SetLeftRight (
  119.     Boolean        inValue)
  120. {
  121.     mLeftRight = inValue;
  122.     
  123.     SignalDataChanged (idLeftRight);
  124. }
  125.  
  126.  
  127. //----------
  128. SInt16        DDocData::GetRadios () const
  129. {
  130.  
  131.     return mRadios;
  132. }
  133.  
  134. //----------
  135. void    DDocData::SetRadios (
  136.     SInt16        inValue)
  137. {
  138.     mRadios = inValue;
  139.     
  140.     SignalDataChanged (idRadios);
  141. }
  142.  
  143.  
  144. //----------
  145. UInt16        DDocData::GetBars () const
  146. {
  147.  
  148.     return mBars;
  149. }
  150.  
  151. //----------
  152. void    DDocData::SetBars (
  153.     UInt16        inValue)
  154. {
  155.     mBars = inValue;
  156.     
  157.     SignalDataChanged (idBars);
  158. }
  159.  
  160.  
  161. //----------
  162. SInt16        DDocData::GetStandard2 () const
  163. {
  164.  
  165.     return mStandard2;
  166. }
  167.  
  168. //----------
  169. void    DDocData::SetStandard2 (
  170.     SInt16        inValue)
  171. {
  172.     mStandard2 = inValue;
  173.     
  174.     SignalDataChanged (idStandard2);
  175. }
  176.  
  177.  
  178. //----------
  179. SInt16        DDocData::GetGraphic () const
  180. {
  181.  
  182.     return mGraphic;
  183. }
  184.  
  185. //----------
  186. void    DDocData::SetGraphic (
  187.     SInt16        inValue)
  188. {
  189.     mGraphic = inValue;
  190.     
  191.     SignalDataChanged (idGraphic);
  192. }
  193.  
  194.  
  195. //----------
  196. SInt16        DDocData::GetSlider () const
  197. {
  198.  
  199.     return mSlider;
  200. }
  201.  
  202. //----------
  203. void    DDocData::SetSlider (
  204.     SInt16        inValue)
  205. {
  206.     mSlider = inValue;
  207.     
  208.     SignalDataChanged (idSlider);
  209. }
  210.  
  211.  
  212. //----------
  213. SInt16        DDocData::GetTickMarks () const
  214. {
  215.  
  216.     return mTickMarks;
  217. }
  218.  
  219. //----------
  220. void    DDocData::SetTickMarks (
  221.     SInt16        inValue)
  222. {
  223.     mTickMarks = inValue;
  224.     
  225.     SignalDataChanged (idTickMarks);
  226. }
  227.  
  228.  
  229. //----------
  230. SInt16        DDocData::GetNonDirectional () const
  231. {
  232.  
  233.     return mNonDirectional;
  234. }
  235.  
  236. //----------
  237. void    DDocData::SetNonDirectional (
  238.     SInt16        inValue)
  239. {
  240.     mNonDirectional = inValue;
  241.     
  242.     SignalDataChanged (idNonDirectional);
  243. }
  244.  
  245.  
  246. //----------
  247. SInt16        DDocData::GetLittleArrows () const
  248. {
  249.  
  250.     return mLittleArrows;
  251. }
  252.  
  253. //----------
  254. void    DDocData::SetLittleArrows (
  255.     SInt16        inValue)
  256. {
  257.     mLittleArrows = inValue;
  258.     
  259.     SignalDataChanged (idLittleArrows);
  260. }
  261.  
  262.  
  263. //----------
  264. SInt16        DDocData::GetSpinner () const
  265. {
  266.  
  267.     return mSpinner;
  268. }
  269.  
  270. //----------
  271. void    DDocData::SetSpinner (
  272.     SInt16        inValue)
  273. {
  274.     mSpinner = inValue;
  275.     
  276.     SignalDataChanged (idSpinner);
  277. }
  278.  
  279.  
  280. //----------
  281. SInt16        DDocData::GetVolumeControl () const
  282. {
  283.  
  284.     return mVolumeControl;
  285. }
  286.  
  287. //----------
  288. void    DDocData::SetVolumeControl (
  289.     SInt16        inValue)
  290. {
  291.     mVolumeControl = inValue;
  292.     
  293.     SignalDataChanged (idVolumeControl);
  294. }
  295.  
  296.  
  297. //----------
  298. SInt16        DDocData::GetJimSSlider () const
  299. {
  300.  
  301.     return mJimSSlider;
  302. }
  303.  
  304. //----------
  305. void    DDocData::SetJimSSlider (
  306.     SInt16        inValue)
  307. {
  308.     mJimSSlider = inValue;
  309.     
  310.     SignalDataChanged (idJimSSlider);
  311. }
  312.  
  313.  
  314. //----------
  315. SInt16        DDocData::GetStandard3 () const
  316. {
  317.  
  318.     return mStandard3;
  319. }
  320.  
  321. //----------
  322. void    DDocData::SetStandard3 (
  323.     SInt16        inValue)
  324. {
  325.     mStandard3 = inValue;
  326.     
  327.     SignalDataChanged (idStandard3);
  328. }
  329.  
  330.  
  331. //----------
  332. SInt16        DDocData::GetIndeterminate () const
  333. {
  334.  
  335.     return mIndeterminate;
  336. }
  337.  
  338. //----------
  339. void    DDocData::SetIndeterminate (
  340.     SInt16        inValue)
  341. {
  342.     mIndeterminate = inValue;
  343.     
  344.     SignalDataChanged (idIndeterminate);
  345. }
  346.  
  347.  
  348. //----------
  349. SInt16        DDocData::GetChasingArrows () const
  350. {
  351.  
  352.     return mChasingArrows;
  353. }
  354.  
  355. //----------
  356. void    DDocData::SetChasingArrows (
  357.     SInt16        inValue)
  358. {
  359.     mChasingArrows = inValue;
  360.     
  361.     SignalDataChanged (idChasingArrows);
  362. }
  363.  
  364.  
  365. //----------
  366. SInt16        DDocData::GetRectangle () const
  367. {
  368.  
  369.     return mRectangle;
  370. }
  371.  
  372. //----------
  373. void    DDocData::SetRectangle (
  374.     SInt16        inValue)
  375. {
  376.     mRectangle = inValue;
  377.     
  378.     SignalDataChanged (idRectangle);
  379. }
  380.  
  381.  
  382. //----------
  383. SInt16        DDocData::GetRoundRect () const
  384. {
  385.  
  386.     return mRoundRect;
  387. }
  388.  
  389. //----------
  390. void    DDocData::SetRoundRect (
  391.     SInt16        inValue)
  392. {
  393.     mRoundRect = inValue;
  394.     
  395.     SignalDataChanged (idRoundRect);
  396. }
  397.  
  398.  
  399. //----------
  400. SInt16        DDocData::GetBarberPole () const
  401. {
  402.  
  403.     return mBarberPole;
  404. }
  405.  
  406. //----------
  407. void    DDocData::SetBarberPole (
  408.     SInt16        inValue)
  409. {
  410.     mBarberPole = inValue;
  411.     
  412.     SignalDataChanged (idBarberPole);
  413. }
  414.  
  415.  
  416. //----------
  417. SInt16        DDocData::GetRoundBarber () const
  418. {
  419.  
  420.     return mRoundBarber;
  421. }
  422.  
  423. //----------
  424. void    DDocData::SetRoundBarber (
  425.     SInt16        inValue)
  426. {
  427.     mRoundBarber = inValue;
  428.     
  429.     SignalDataChanged (idRoundBarber);
  430. }
  431.  
  432.  
  433. //----------
  434. StringPtr    DDocData::GetSmall (
  435.     Str255        outPtr) const
  436. {
  437.  
  438.     if (outPtr != nil) {
  439.         LString::CopyPStr (mSmall, outPtr);
  440.     }
  441.     return (StringPtr)mSmall;
  442. }
  443.  
  444. //----------
  445. void    DDocData::SetSmall (
  446.     ConstStringPtr    inValue)
  447. {
  448.     LString::CopyPStr (inValue, mSmall);
  449.     
  450.     SignalDataChanged (idSmall);
  451. }
  452.  
  453. //----------
  454. void    DDocData::SetSmall (
  455.     CharsHandle        inValue)
  456. {
  457.     SetPStr (mSmall, sizeof (mSmall), inValue);
  458.     
  459.     SignalDataChanged (idSmall);
  460. }
  461.  
  462.  
  463. //----------
  464. StringPtr    DDocData::GetLarge (
  465.     Str255        outPtr) const
  466. {
  467.  
  468.     if (outPtr != nil) {
  469.         LString::CopyPStr (mLarge, outPtr);
  470.     }
  471.     return (StringPtr)mLarge;
  472. }
  473.  
  474. //----------
  475. void    DDocData::SetLarge (
  476.     ConstStringPtr    inValue)
  477. {
  478.     LString::CopyPStr (inValue, mLarge);
  479.     
  480.     SignalDataChanged (idLarge);
  481. }
  482.  
  483. //----------
  484. void    DDocData::SetLarge (
  485.     CharsHandle        inValue)
  486. {
  487.     SetPStr (mLarge, sizeof (mLarge), inValue);
  488.     
  489.     SignalDataChanged (idLarge);
  490. }
  491.  
  492.  
  493. //----------
  494. SInt32        DDocData::GetX12345 () const
  495. {
  496.  
  497.     return mX12345;
  498. }
  499.  
  500. //----------
  501. void    DDocData::SetX12345 (
  502.     SInt32        inValue)
  503. {
  504.     mX12345 = inValue;
  505.     
  506.     SignalDataChanged (idX12345);
  507. }
  508.  
  509.  
  510. //----------
  511. double        DDocData::GetX12345e6 () const
  512. {
  513.  
  514.     return mX12345e6;
  515. }
  516.  
  517. //----------
  518. void    DDocData::SetX12345e6 (
  519.     double        inValue)
  520. {
  521.     mX12345e6 = inValue;
  522.     
  523.     SignalDataChanged (idX12345e6);
  524. }
  525.  
  526.  
  527. //----------
  528. StringPtr    DDocData::GetPassword (
  529.     Str255        outPtr) const
  530. {
  531.  
  532.     if (outPtr != nil) {
  533.         LString::CopyPStr (mPassword, outPtr);
  534.     }
  535.     return (StringPtr)mPassword;
  536. }
  537.  
  538. //----------
  539. void    DDocData::SetPassword (
  540.     ConstStringPtr    inValue)
  541. {
  542.     LString::CopyPStr (inValue, mPassword);
  543.     
  544.     SignalDataChanged (idPassword);
  545. }
  546.  
  547. //----------
  548. void    DDocData::SetPassword (
  549.     CharsHandle        inValue)
  550. {
  551.     SetPStr (mPassword, sizeof (mPassword), inValue);
  552.     
  553.     SignalDataChanged (idPassword);
  554. }
  555.  
  556.  
  557. //----------
  558. LongDateRec        DDocData::GetDate () const
  559. {
  560.  
  561.     return mDate;
  562. }
  563.  
  564. //----------
  565. void    DDocData::SetDate (
  566.     LongDateRec        inValue)
  567. {
  568.     mDate = inValue;
  569.     
  570.     SignalDataChanged (idDate);
  571. }
  572.  
  573.  
  574. //----------
  575. LongDateRec        DDocData::GetTime () const
  576. {
  577.  
  578.     return mTime;
  579. }
  580.  
  581. //----------
  582. void    DDocData::SetTime (
  583.     LongDateRec        inValue)
  584. {
  585.     mTime = inValue;
  586.     
  587.     SignalDataChanged (idTime);
  588. }
  589.  
  590.  
  591. //----------
  592. StringPtr    DDocData::GetStyled (
  593.     Str255        outPtr) const
  594. {
  595.  
  596.     if (outPtr != nil) {
  597.         LString::CopyPStr (mStyled, outPtr);
  598.     }
  599.     return (StringPtr)mStyled;
  600. }
  601.  
  602. //----------
  603. void    DDocData::SetStyled (
  604.     ConstStringPtr    inValue)
  605. {
  606.     LString::CopyPStr (inValue, mStyled);
  607.     
  608.     SignalDataChanged (idStyled);
  609. }
  610.  
  611. //----------
  612. void    DDocData::SetStyled (
  613.     CharsHandle        inValue)
  614. {
  615.     SetPStr (mStyled, sizeof (mStyled), inValue);
  616.     
  617.     SignalDataChanged (idStyled);
  618. }
  619.